import Vue from 'vue';
import Router from 'vue-router';
// FIXME 增加路由懒加载 配置路由分组打包
import Home from './views/Home.vue';
import Login from './views/Login.vue';
import Patch from './views/Patch.vue';
import Index from './views/Index.vue';

import Photos from './views/manage/photoManage/index.vue';
import Videos from './views/manage/videoManage/index.vue';


Vue.use(Router);
const router = new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [{
        path: '/login',
        name: 'login',
        component: Login,
        isShow: 0,
        type: 0,
    },
    {
        path: '/',
        name: 'home',
        component: Home,
        isShow: 0,
        type: 0,
        redirect: '/photos',
        icon: 'el-icon-location',
        children: [
            // {
            //     path: '/index',
            //     name: '首页',
            //     component: Index,
            //     isShow: 1,
            //     icon: 'el-icon-s-grid',
            //     type: 1,
            //     meta: {
            //         keepAlive: false,
            //     },
            //     children: []
            // },
            {
                path: '/photos',
                name: '图片管理',
                component: Photos,
                isShow: 1,
                icon: 'el-icon-s-grid',
                type: 1,
                meta: {
                    keepAlive: false,
                },
                children: [],
            },
            {
                path: '/videos',
                name: '视频管理',
                component: Videos,
                isShow: 1,
                icon: 'el-icon-s-grid',
                type: 1,
                meta: {
                    keepAlive: false,
                },
                children: [],
            },
            // {
            //     path: '/funmenu',
            //     name: '栏目一',
            //     component: Patch,
            //     isShow: 1,
            //     icon: 'el-icon-remove',
            //     type: 1,
            //     children: [{
            //         path: '/funmenu/form',
            //         name: '菜单一',
            //         isShow: 1,
            //         component: Index,
            //         icon: 'el-icon-bell',
            //         type: 2,
            //         meta: {
            //             keepAlive: false,
            //         },
            //         children: []
            //     }, {
            //         path: '/funmenu/form1',
            //         name: '菜单二',
            //         type: 2,
            //         isShow: 1,
            //         component: Index,
            //         icon: 'el-icon-bell',
            //         meta: {
            //             keepAlive: false,
            //         },
            //         children: []
            //     }, ],
            // },
        ],
    },
    ],
});

// const login = false;

// // 全局导航守卫
// router.beforeEach((to, from, next) => {
//     // 判断登录状态,登录的跳转 未登录的跳转到登录页面
//     // 判断登录状态
//     if (!login && to.path !== '/login') {
//         next({ path: '/login' });
//     } else {
//         next();
//     }
// });
export default router;
